<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Aria: ArScopedLock Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Aria
   &#160;<span id="projectnumber">2.9.4</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classArScopedLock.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classArScopedLock-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">ArScopedLock Class Reference<div class="ingroups"><a class="el" href="group__UtilityClasses.html">Utility Classes</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Locks a given mutex when created, and unlocks the mutex when destroyed.  
 <a href="classArScopedLock.html#details">More...</a></p>

<p><code>#include &lt;ArMutex.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a159d03a56928fc3d664c7f8022496934"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a159d03a56928fc3d664c7f8022496934"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>ArScopedLock</b> (<a class="el" href="classArMutex.html">ArMutex</a> &amp;m)</td></tr>
<tr class="separator:a159d03a56928fc3d664c7f8022496934"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a61d1c66428703b2f6017d5b1b6a7bacd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a61d1c66428703b2f6017d5b1b6a7bacd"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>lock</b> ()</td></tr>
<tr class="separator:a61d1c66428703b2f6017d5b1b6a7bacd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af419c4ff591e961de7183d1e3fd0abae"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af419c4ff591e961de7183d1e3fd0abae"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>unlock</b> ()</td></tr>
<tr class="separator:af419c4ff591e961de7183d1e3fd0abae"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Locks a given mutex when created, and unlocks the mutex when destroyed. </p>
<p>If created on the stack then it will hold the lock until the scope in which it was created (e.g. a function body) ends. For example: </p><div class="fragment"><div class="line"><a class="code" href="classArMutex.html">ArMutex</a> myMutex;</div><div class="line"><span class="keywordtype">void</span> example()</div><div class="line">{</div><div class="line">  <a class="code" href="classArScopedLock.html">ArScopedLock</a>(myMutex);</div><div class="line">  <span class="keywordtype">int</span> r = randomInRange(0, 100);</div><div class="line">  <span class="keywordflow">if</span>(r &gt; 50)</div><div class="line">  {</div><div class="line">    puts(<span class="stringliteral">&quot;&gt;50&quot;</span>);</div><div class="line">    <span class="keywordflow">return</span>; <span class="comment">// myMutex will be unlocked here in this condition</span></div><div class="line">  } </div><div class="line">  <span class="keywordflow">else</span> <span class="keywordflow">if</span>(r &lt; 50)</div><div class="line">  {</div><div class="line">    puts(<span class="stringliteral">&quot;&lt;50&quot;</span>);</div><div class="line">    <span class="keywordflow">return</span>; <span class="comment">// myMutex will also be unlocked here in this else case</span></div><div class="line">  }</div><div class="line">  </div><div class="line">  puts(<span class="stringliteral">&quot;=50&quot;</span>);</div><div class="line">  <span class="comment">// myMutex will also be unlocked here at the end of the function </span></div><div class="line">}</div></div><!-- fragment --> </div><hr/>The documentation for this class was generated from the following file:<ul>
<li>ArMutex.h</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="classArScopedLock.html">ArScopedLock</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
